package com.yfp.client.controller;


import com.yfp.client.annotation.AnonymousAccess;
import com.yfp.client.service.MallOrderService;
import com.yfp.client.service.OrderService;
import com.yfp.client.util.Response;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/job")
@Tag(name = "定时任务接口")
@Slf4j
public class JobController {

    @Autowired
    private OrderService orderService;
    @Resource
    private MallOrderService mallOrderService;

    @AnonymousAccess
    @Operation(summary = "检查订单是否过期")
    @GetMapping("/check/order/expired")
    public Response<Void> checkAllOrderExpired() {
        orderService.checkAllOrderExpired();
        return Response.success();
    }

    @AnonymousAccess
    @Operation(summary = "商城物流信息")
    @GetMapping("/mall/logistics-info")
    public Response<Void> updateOrderLogisticsInfoJob() {
        mallOrderService.updateOrderLogisticsInfoJob();
        return Response.success();
    }
}
